-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call controller methods directly in send duck #14465
call controller methods directly in send duck #14465
Conversation
13d23c0
to
10cfc1e
Compare
SWAP_TRANSACTION_TYPES.includes(transactionType) || | ||
transactionType === TRANSACTION_TYPES.SIMPLE_SEND || | ||
transactionType === TRANSACTION_TYPES.TOKEN_METHOD_TRANSFER || | ||
transactionType === TRANSACTION_TYPES.TOKEN_METHOD_TRANSFER_FROM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be more readable if we create a var to hold all of these cases?
var VALID_TRANSACTION_TYPES = [
...SWAP_TRANSACTION_TYPES,
TRANSACTION_TYPES.SIMPLE_SEND,
// ....
]
........
!(VALID_TRANSACTION_TYPES.includes(transactionType))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
REsolved in latest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌 Nice cleanup
ui/store/actions.js
Outdated
txParams, | ||
origin, | ||
'metamask', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Are we certain origin can't be another value? I'm unfamiliar with where the origin(s) of origin are.
The other thing I'm wondering is if it would help to turn this into a constant value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably good to use a constant. Origin is always the dapp that suggests the transaction. Because this method will only be called from within MetaMask the transaction will always originate from metamask.
ba889b0
to
3ad0233
Compare
Builds ready [d41495c]Page Load Metrics (1439 ± 91 ms)
highlights:storybook
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me and I was able to send a native ETH and ERC-20!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Explanation
There is no need for us to call provider methods in our send duck to create transactions, we already generate the txParams.data for transactions but strip it from the call to these provider methods so that the provider methods generate them for us. However the logic we use for generating the txParams.data in the send duck is the same as the logic these methods invoke.
This change will allow us to get a handle on the created transactionMeta and update it when necessary. We don't do that yet, but in a future PR I will add additional logging to the transaction history to show the steps that a user took to create the transaction. This will help us further debug transactions that are flagged in support tickets.
Manual testing steps